package com.youlu.campus.entity.commission;

import com.youlu.campus.base.base.EntityBase;
import com.youlu.campus.entity.commission.enums.SharingCommissionProfitStatus;
import com.youlu.campus.entity.enums.SharingProfitOrderTypeEnum;
import com.youlu.campus.entity.enums.SharingProfitStatus;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;
import java.util.Date;


/**
 * 分拥订单明细
 */
@Getter
@Setter
@Document(collection = "sharing_commission_detail")
public class SharingCommissionDetail extends EntityBase {

    /**
     * 活动ID
     */
    private String activityId;

    /**
     * 活动名称
     */
    private String activityName;

    /**
     * 原订单号
     *
     */
    @Indexed(unique = true)
    private String orderNo;

    /**
     * 分拥订单号
     */
    private String profitSharingOrderNo;

    private String transactionId;

    private Date payTime;

    /**
     * 分拥订单号总金额（单位分）
     */
    private Integer orderAmount;


    /**
     * 分拥类型
     * 电子证书订单  DIGITAL_CA_ORDER
     * <p>
     * 纸质证书订单 PAPER_CA_ORDER
     * <p>
     * 视频订单  VIDEO_ORDER
     */
    private SharingProfitOrderTypeEnum sharingProfitOrderType;

    /**
     * 分拥金额比例
     */
    private Double sharingCommissionRatio;

    /**
     * 分拥金额（单位分）
     */
    private Integer sharingCommissionAmount;

    /**
     * 提高分拥比例
     */
    private Double incSharingCommissionRatio;

    /**
     * 基础分拥比例
     */
    private Double baseSharingCommissionRatio;


    /**
     * 分拥账户 商户Id/openId
     */
    private String sharingProfitAccount;

    private Integer sharingCommissionStatus = SharingCommissionProfitStatus.UNSETTLED.getValue();

    /**
     * 备注信息 如退回订单备注
     */
    private String remark;
    /**
     * 分拥退回时间
     */
    private Date sharingProfitRefundTime;

    /**
     * 分拥类型 1、商户 2、个人
     */
    private Integer sharingCommissionType  =2;

    private String appId;

    /**
     * 商户号ID-所属分拥订单
     */
    private String merchantId;

    /**
     * 商户号名称-所属分拥订单
     */
    private String merchantName;


    private DistributorCommission distributorCommission;

    /**
     * 是否已退款
     * true 已退款
     * false 未退款
     */
    private Boolean refund = Boolean.FALSE;

    /**
     * 结算时间
     */
    @Indexed
    private LocalDateTime settledTime;




}
